<?
	// Get current query
	if(isset($_REQUEST['q'])) {
		$GL_QUERY = $_REQUEST['q'];
	}
	else {
		$GL_QUERY = "";
	}

	// Get current query
	if(isset($_REQUEST['n'])) {
		$GL_NUM_IMAGES = $_REQUEST['n'];
	}
	else {
		$GL_NUM_IMAGES = "5";
	}
	
	// Get bank of image thumbs
	ini_set('user_agent','Mozilla/1.0 (compatible; NCSA Mosaic; Atari 800-ST)');
	$imageResults = file_get_contents('http://images.google.com/images?q=' . urlencode($GL_QUERY));
	preg_match_all('(http://\w+\.google\.com/images\?[^\s]+)',$imageResults,$results);

  	for($i = 0; $i < $GL_NUM_IMAGES; $i++) {
		print "<img src=\"" . $results[0][$i]. "\" />,";
  	}
?>